import { Component } from "react";
import { GetCountData } from "@/network/count/model";
import { getCount } from "@/network/count/service";
import { Props, State } from "./model";
export default class Service extends Component<Props,State>{
   
    state: Readonly<State>={
        count:{
            areaName: "1",
            capitalItemsCount: "1",
            countEntApply: "1",
            countEntApplyS: "1",
            countUnits: "1",
            countUsable: "1",
            sumApplyAmount: "1",
        }
    };

    setCount=async()=>{
        const currentArea = JSON.parse(localStorage.getItem("currentArea") as string)
        const data = await getCount({
            areaId:currentArea?.key,
            areaName:currentArea?.key
        })
        this.setState({
            count:data as GetCountData
        })
    }
    componentWillMount = async()=>{
        this.setCount()
    }
}